package com.miyu.system.utils.webService;


import org.dom4j.CDATA;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.jws.WebService;


/**
 * web服务impl
 *
 * @author longmy
 * @date 2022/04/12
 */
@Service
@Component
@WebService(serviceName = "testWebService",
        targetNamespace = "http://webService.utils.system.miyu.com/",
        endpointInterface="com.miyu.system.utils.webService.TestWebService"
)
public class TestWebServiceImpl implements TestWebService {

    @Override
    public String sendMsg(String msgHeader,String msgBody) {
        System.out.println("接受参数 msgHeader>>>>>>"+msgHeader);
        System.out.println("接受参数 msgBody>>>>>>"+msgBody);
        Document document = DocumentHelper.createDocument();
        Element root = document.addElement("root");
        Element returnContents = root.addElement("returnContents");
        Element returnContent = returnContents.addElement("returnContent");
        returnContent.addElement("JDXSZFBTF").addText("2451.54");
        returnContent.addElement("YLSCK").addText("24.54");
        returnContent.addElement("YBCE").addText("21.54");
        returnContent.addElement("ACCOUNT_END_DATE").addText("2022-05-06 23:59:59.000");
        CDATA cdata = DocumentHelper.createCDATA(document.asXML());
        StringBuffer sb = new StringBuffer();
        sb.append(cdata.asXML());
        System.out.println("返回数据"+sb.toString());
        return sb.toString();
    }
}
